<template>
  <div>
    <ul>
      <li><router-link to="/contacts/allcontact">UI_Router</router-link></li>
      <li>
        <router-link to="/contacts/alice">Alice</router-link>
      </li>
      <li>
        <router-link to="/contacts/bob">Bob</router-link>
      </li>
    </ul>
    <button @click="fn">随机显示</button>

    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ["/contacts/allcontact", "/contacts/alice", "/contacts/bob"],
    };
  },
  methods: {
    fn() {
      this.$router.push(this.arr[Math.floor(Math.random() * 3)]);
    },
  },
};
</script>

<style scoped>
.router-link-active {
  color: rgb(224, 64, 168);
}
</style>
